package com.fanqwz.kotlinmvvm.ui.activity

import com.fanqwz.kotlinmvvm.ui.compositor.ProgressCompositor
import com.fanqwz.kotlinmvvm.ui.compositor.ViewCompositor
import io.reactivex.subjects.BehaviorSubject

/**
 * Created by fanqwz on 2018/3/7.
 */
open class ProgressActivity : BaseActivity() {
    private val progressState = BehaviorSubject.createDefault(false)
    private lateinit var progressCompositor: ProgressCompositor
    override fun buildViewCompositor(): ViewCompositor {
        progressCompositor = ProgressCompositor(this@ProgressActivity, dataBindingComponent, progressState.hide())
        super.buildViewCompositor().addChild(progressCompositor)
//        val mvvmCompositor = object : ViewCompositor() {
//            override fun inflateView(layoutInflater: LayoutInflater): View? {
//                val modelView = createModelView()
//                binding = DataBindingUtil.bind(modelView, dataBindingComponent)!!
//                mvvmBaseBinding = DataBindingUtil.inflate(layoutInflater, R.layout.activity_mvvm_base, null, false)!!
//                mvvmBaseBinding.fragmentBaseContainer.addView(modelView)
//                return mvvmBaseBinding.root
//            }
//        }

//        mvvmCompositor.apply {
//            super.buildViewCompositor().addChild(this)
//            addChild(progressCompositor)
//        }
        return progressCompositor
    }
}